#ifndef __IDEVICE_H__
#define __IDEVICE_H__

#include "CTypes.h"
#include "UsefulData.h"

/**
* Class interface for a device. It provides of driver-specific functions, such as chaging resolution or changing the captions of the window.
* Most of the device dependent functions have to be declared in this class.
* @author Ismael Gonzalez Burgos
*/
class IDevice
{
protected:
	stringc Name;										//!< Name of the device.
	vector2du32 ScreenLen;								//!< Lenght in pixels of the window (resolution).
public:
	/**
	* Default constructor with initialization params.
	* @param DrvParams Structure containing the initialization params.
	*/
	IDevice(StartDriverParams *DrvParams)				{							}

	/**
	* Default destructor.
	*/
	virtual ~IDevice()									{							}

	/**
	* Method to change name of the device.
	* @param NewName New name for the device.
	*/
	inline void SetName(stringc NewName)			{	Name = NewName;		}

	/**
	* Function for retrieving the name of the device.
	* @return The actual name of the device.
	*/
	inline const s8* GetName()						{	return Name.c_str();	}

	/**
	* Function for retrieving the caption of the device.
	* @return The actual caption of the window device.
	*/
	virtual stringc GetCaption()							= 0;

	/**
	* Method to change the caption of the window's device.
	* @param Title New title for the window.
	*/
	virtual void SetCaption(stringc Title)					= 0;

	/**
	* Method for create a window (device dependent) and attaching it to the PLE system.
	* @return If it was possible to create the window or not.
	*/
	virtual bool CreatePLEWindow()							= 0;
	virtual void CreateDriver()								= 0;
	virtual void CreateOpenGLDriver()						= 0;
	virtual void CreateNullDriver()							= 0;
	virtual bool Update()									= 0;
	virtual DeviceTypeENUM GetDeviceType()					= 0;
    virtual void CreateCommonWindow()						= 0;

	virtual vector2du32 &GetScreenLen()				{	return ScreenLen;		}
	virtual u32 GetScreenLenX()						{	return ScreenLen.X;		}
	virtual u32 GetScreenLenY()						{	return ScreenLen.Y;		}
};

POWERLIBRARYENGINE_API IDevice *GetDevice();
void SetDevice(IDevice *nv);
#define Device			GetDevice()

#endif
